package com.wander.patterns.act.strategy;

import lombok.Data;

/**
 * @description:
 * @author: zhuyong
 * @create: 2019-09-11 16:14
 **/
@Data
public class Context {

    private Strategy strategy;

    public Context(Strategy strategy) {
        this.strategy = strategy;
    }

    //在Spring 中采用ioc注入进来
    public double printPrice(double price){
        double res = strategy.getPrice(price);
        System.out.println("您的报价:"+ res);
        return res;
    }

}
